package com.kanshu.ksgb.fastread.doudou.module.personal.activity

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Route
import com.kanshu.ksgb.fastread.doudou.R
import com.kanshu.ksgb.fastread.doudou.app.constants.ARouterConfig
import com.kanshu.ksgb.fastread.doudou.base.baseui.BaseActivity
import com.kanshu.ksgb.fastread.doudou.module.personal.bean.WithdrawResult
import kotlinx.android.synthetic.main.activity_encashment.*

@Route(path = ARouterConfig.PERSONAL_ENCASHMENT_RESULT)
class EncashmentResultActivity :BaseActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_encashment_result)
        title = "零钱提现"
        val data = intent.getParcelableExtra<WithdrawResult>("data")
        if(data != null){
            val result = data.rmb.toFloat()/100
            val txt = String.format("%1$.2f",result)
            total_amount.text = txt
        }else{
            finish()
        }

    }

    companion object {
        @JvmStatic
        fun actionStart(activity:Activity, data:WithdrawResult){
            val intent = Intent(activity,EncashmentResultActivity::class.java)
            intent.putExtra("data",data)
            activity.startActivity(intent)
        }
    }
}
